#ifndef __WIRE_THROUGH_BLOCK_H__
#define __WIRE_THROUGH_BLOCK_H__

#include "Block.hpp"

namespace PocketSurvival
{
    class WireThroughBlock : public Block
    {
    public:
		WireThroughBlock();
        virtual BlockPlacementData getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult) override; 

		static inline int32_t GetWiredFace(int32_t data);
		static inline int32_t SetWiredFace(int32_t data, int32_t wiredFace);
    };

	inline int32_t WireThroughBlock::GetWiredFace(int32_t data)
	{
		if ((data & 3) == 0)
		{
			return 0;
		}
		if ((data & 3) == 1)
		{
			return 1;
		}
		return 4;
	}
	inline int32_t WireThroughBlock::SetWiredFace(int32_t data, int32_t wiredFace)
	{
		data &= -4;
		switch (wiredFace)
		{
		case 0:
		case 2:
			return data;
		case 1:
		case 3:
			return data | 1;
		default:
			return data | 2;
		}
	}


} // namespace PocketSurvival

#endif